﻿

using System;
using System.Collections;
using System.Data;
using Model;
using IList=System.Collections.IList;


namespace Service
{
    public class UitilityService
    {
        private string DefaultDateTime = string.Empty ;
        private string FrenchFormat = "dd/mm/yyyy";
        private string EnglishFormat = "mm/dd/yyyy";
       public IList GetRangeCodeNumber(int startNumber, int numberAmount)
       {
           IList list = new ArrayList();
           for(int i=startNumber +1 ;i<=startNumber+numberAmount; i++)
           
               list.Add(startNumber);
           
           return list;
       }
       public static string ConvertDateToString(DateTime dateTime,string format)
       {
           if (dateTime == null) return string.Empty;
           if (dateTime.ToShortDateString().Equals("1/1/0001"))
               return string.Empty;
           return dateTime.ToString(format);
       }
       public string ConvertDateToStringEnglishFormat(DateTime dateTime)
       {
           return ConvertDateToString(dateTime, EnglishFormat);
       }
       public string ConvertDateToStringFrenchFormat(DateTime dateTime, string format)
       {
           return ConvertDateToString(dateTime, FrenchFormat);
       }
       public Hashtable GetUserPermissions  (DataTable permission)
       {
           Hashtable permissionHashTable  = new Hashtable();
           foreach (DataRow row in permission.Rows)
           {
               permissionHashTable.Add(row["permissionId"].ToString(), row["permissionId"].ToString());
           }
           return permissionHashTable;
           
       }
       
      
    }
}
